<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>

<ul id='ul1'>
	<li></li>
	<li></li>
	<li class='box'></li>
	<li></li>
	<li class='box'></li>
	<li></li>
	<li class='box'></li>
</ul>
<script type="text/javascript">
	window.onload=function(){
		var oUl = document.getElementById('ul1')
		var oLi = document.getElementsByTagName('li')

		for(i=0;i<oLi.length;i++){
			if(oLi[i].className == 'box'){
				oLi[i].style.background='red'
			}
		}
	}
</script>

</body>
</html>